package StuClass;

public class StuClass {
    //属性
    int id;
    String name;
    int age;
    Computer computer;//电脑属性,调用Computer类
    Phone phone;//手机属性,调用Phone类
    void study(){
        System.out.println("我在学习!!!,使用的电脑:"+computer.brand);
    }
    void play(){
        System.out.println("我在玩游戏!!!,使用的手机:"+phone.brand);
    }

    //程序入口,必须有
    public static void main(String[] args) {
        //实例化对象
        StuClass stu=new StuClass();
        stu.id=3161;
        stu.age=18;
        stu.name="lqk";

        //实例化Computer类
        Computer comp=new Computer();
        comp.brand="联想";

        //实例化Phone类
        Phone ph=new Phone();
        ph.brand="小米-MIX3";

        stu.computer=comp;
        stu.phone=ph;
        stu.play();
        stu.study();
    }

}
 class Computer{
    String brand;
}
 class Phone{
    String brand;
}